<template>
<div class="">
  <!-- 事故发生的可能性(L)判定准则 -->
  <div class="border">
    <span class="content">事故发生的可能性(L)判定准则</span>
    <el-table v-loading="listLoading" :data="list" @row-click="checkRadioOne" max-height="400px">
      <el-table-column label="选择" width="50">
        <template slot-scope="scope">
          <el-radio v-model="checkOne" :label="scope.$index">&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column type="index" label="序号" align="left" width="60"/>
      <el-table-column prop="point" label="等级" align="left" width="60"/>
      <el-table-column prop="name" label="标准" align="left" />
    </el-table>
  </div>
  <!-- 事故后果严重性(s)判定准则 -->
  <div class="border">
    <span class="content">事故后果严重性(S)判定准则</span>
      <el-table v-loading="listLoading" :data="tableList" @row-click="checkRadioTwo" max-height="400px">
      <el-table-column label="选择" width="50">
        <template slot-scope="scope">
          <el-radio v-model="checkTwo" :label="scope.$index">&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column type="index" label="序号" align="left" width="60"/>
      <el-table-column prop="point" label="等级" align="left" width="60"/>
        <el-table-column prop="flfg" label="法律法规及其他要求" align="left" />
        <el-table-column prop="rysw" label="人员伤亡" align="left" />
        <el-table-column prop="zjjjss" label="直接经济损失（万元）" align="left" />
        <el-table-column prop="tg" label="停工" align="left" />
        <el-table-column prop="gsxx" label="企业形象" align="left" />
    </el-table>
  </div>

    <el-button type="text" @click="determine">
      请先选择表格确定后在提交
    </el-button>
</div>
</template>
<script>

import request from '@/utils/request'

export default {
  props: ['data'],
  data() {
    return {
      checkOne: {},
      checkTwo: {},
      numberOne:'',
      numberTwo:'',
      row:{},
      
      listLoading:false,
      list:[],
      query: {
        type:'LS',
        typechildren:'L',
      },

      tableList:[],
      queryS: {
        type:'LS',
        typechildren:'S',
      },
    }
  },
  created() {
    this.initData();
    this.initDataTwo();
    },
  methods: {
    initLs(){
      this.checkOne = {}
      this.checkTwo= {}
    },
    determine() {
      let sum = this.numberTwo * this.numberOne
      this.$emit('point',sum)
    },
    checkRadioOne(row) {
      this.checkOne = row
      this.numberOne = Number(row.point)
    },
    checkRadioTwo(row) {
      this.checkTwo = row
      this.numberTwo = Number(row.point)
    },
    initData() {
      this.listLoading = true;
      let query = {
        ...this.query
      };
      request({
        url: `/api/System/rsikStandard`,
        method: 'get',
        data: query
      }).then(res => {
        this.list = res.data.list
        this.listLoading = false
        this.$nextTick(() => {
          this.tableHeight = "100%"
        });
      })
    },
    initDataTwo() {
      this.listLoading = true;
      let query = {
        ...this.queryS
      };
      request({
        url: `/api/System/rsikQuence`,
        method: 'get',
        data: query
      }).then(res => {
        this.tableList = res.data.list
        this.tableList.check = ''
        this.listLoading = false
        this.$nextTick(() => {
            this.tableHeight = "100%"
        });
      })
    },
  }
}
</script>
